/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.active;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanStubArmCommandType;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BCD;
import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.ENUM;

/**
 * <b>(DianlanStubArm)</b>
 *
 * @author czj
 * @version 1.0.0
 * @since 2023/1/13
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanStubArm {
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 0, end = 7, dataType = BCD)
    String                    stubNo;
    /** 桩类型: 0 直流、1 交流 */
    @Builder.Default
    @DianlanProtocol(length = 1, start = 7, end = 8, dataType = BCD)
    String                    stubType          = "00";
    /** 充电枪数量 */
    @Builder.Default
    @DianlanProtocol(length = 1, start = 8, end = 9, dataType = BCD)
    String                    chargingPortCount = "01";
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 9, end = 10, dataType = BCD)
    String                    chargingPortNo;
    @Builder.Default
    @DianlanProtocol(length = 1, start = 10, end = 11, dataType = BCD)
    String                    reservedPlace1    = "01";
    @Builder.Default
    @DianlanProtocol(length = 1, start = 11, end = 12, dataType = BCD)
    String                    reservedPlace2    = "00";
    /**
     * 0x03 枪线左移：其中包含：臂上移、线伸出
     * 0x04 枪线右移：其中包含：臂上移、线伸出
     * 0x06 充电结束：推出枪头、收线、臂下移、臂复位
     * 0x07 充电门打开
     * 0x08 充电门关闭
     * 0x00 备用
     */
    @DianlanProtocol(length = 1, start = 12, end = 13, dataType = ENUM)
    DianlanStubArmCommandType stubArmCommandType;
    @Builder.Default
    @DianlanProtocol(length = 1, start = 13, end = 14, dataType = BCD)
    String                    reservedPlace3    = "00";
    @Builder.Default
    @DianlanProtocol(length = 1, start = 14, end = 15, dataType = BCD)
    String                    reservedPlace4    = "00";
    @Builder.Default
    @DianlanProtocol(length = 1, start = 15, end = 16, dataType = BCD)
    String                    reservedPlace5    = "00";
    @Builder.Default
    @DianlanProtocol(length = 1, start = 16, end = 17, dataType = BCD)
    String                    reservedPlace6    = "00";
    @Builder.Default
    @DianlanProtocol(length = 1, start = 17, end = 18, dataType = BCD)
    String                    reservedPlace7    = "00";
}
